home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_07
/
storn
/
report
< prev
next >
Wrap
Text File
|
1994-05-03
|
3KB
|
55 lines
line 1: { 0} ( 0) /* 0*/ " 0" #include "stdtyp.h"
line 2: { 0} ( 0) /* 0*/ " 0" #include <<stdio.h>>
line 3: { 0} ( 0) /* 0*/ " 0"
line 4: { 0} ( 0) /* 0*/ " 0" void main(int argc, char *argv[])
line 5: { 1} ( 0) /* 0*/ " 0" {
line 6: { 1} ( 0) /* 0*/ " 0" FILE *fp1, *fp2;
line 7: { 1} ( 0) /* 0*/ " 0" int l;
line 8: { 2} ( 0) /* 0*/ " 0" if ((fp1 = fopen(argv[1],"rw"))==0) {
line 9: { 2} ( 0) /* 0*/ " 0" printf("\n Cannot open output file 1 %s",argv[1]);
line 10: { 2} ( 0) /* 0*/ " 0" exit(0);
line 11: { 1} ( 0) /* 0*/ " 0" }
line 12: { 1} ( 0) /* 0*/ " 0" fp2 = fopen(argv[2],"rw");
line 13: { 1} ( 0) /* 0*/ " 0"
line 14: { 1} ( 0) /* 0*/ " 0" printf("1. Bubble sort\n");
line 15: { 1} ( 0) /* 0*/ " 0" printf("2. Quick sort \n");
line 16: { 1} ( 0) /* 0*/ " 0" printf("3. Merge sort\n");
line 17: { 1} ( 0) /* 0*/ " 0"
line 18: { 1} ( 0) /* 0*/ " 0" switch(l = scanf("%d",&l))
line 19: { 2} ( 0) /* 0*/ " 0" {
line 20: { 2} ( 0) /* 0*/ " 0" case 1 :
line 21: { 2} ( 0) /* 0*/ " 0" bub_sort(fp1,fp2);
line 22: { 2} ( 0) /* 0*/ " 0"
line 23: { 2} ( 0) /* 0*/ " 0" case 2:
line 24: { 2} ( 0) /* 0*/ " 0" qck_sort(fp1,fp2);
line 25: { 2} ( 0) /* 0*/ " 0" break;
line 26: { 2} ( 0) /* 0*/ " 0"
line 27: { 2} ( 0) /* 0*/ " 0" case 3:
line 28: { 2} ( 0) /* 0*/ " 0" mg_sort(fp1,fp2);
line 29: { 2} ( 0) /* 0*/ " 0" break;
line 30: { 1} ( 0) /* 0*/ " 0" }
line 31: { 1} ( 0) /* 0*/ " 0" fclose(fp1); fclose(fp2);
WARNING (line 31): this function has 0 comment lines only for 25 lines of code, please use at least 5 comment lines.
line 32: { 0} ( 0) /* 0*/ " 0" }
line 33: { 0} ( 0) /* 0*/ " 0"
line 34: { 0} ( 0) /* 0*/ " 0"
WARNING : 1 function(s) of this program is(are) not enough commented, see listing above for details.
WARNING (line 8) : == is forbidden, please use EQ instead.
WARNING (line 4) : unsigned or (signed) char is forbidden, please use UCHAR or CHAR instead.
WARNING (line 7) : int is forbidden, please use either BITFIELD if unsigned or SHORT or LONG if signed instead.
WARNING (line 7) : l (easily confused with 1) is forbidden, please use any other variable name instead.
WARNING (line 8) : the symbol { should stand in a separate line.
WARNING (line 31) : the symbol ; should stand at the end of the line : there should be no more than one executable statement in a single line.
WARNING (line 6) : the name of this pointer is wrong, it should end with _ptr.
WARNING (line 23) : there is no break before this case. If the fall-through behaviour is deliberate, don't forget extensive comments !
WARNING (line 18) : every switch selection must exhibit a default label.
WARNING (line 8) : assignement in control flow statement should be avoided.
WARNING (line 12) : the status information returned by this library function should be checked for validity before use.
WARNING (line 18) : it is better to avoid using both value and address of an object in the same statement.